#!/usr/bin/env python

# use regular expressions
import re
import eyeD3
import os
# os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]])

if __name__ == '__main__':
    import sys
    if len(sys.argv) > 1:
        File = sys.argv[1]
        # make sure it's an mp3 file.
        pattern = re.compile(r'.*mp3$')
        matchobj = pattern.match(File,re.I)
        if ( matchobj ):
            tag = eyeD3.Tag()
            if ( tag.link(File) != False ):
                print 'File   = ',File
                print 'Artist =',tag.getArtist()
                print 'Album  = ',tag.getAlbum()
                print 'Title  = ',tag.getTitle()
                print 'Track Num = ',tag.getTrackNum()[0]
            else:
                print 'no tag found'
        else:
            print 'no match'

            
        
